<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <title>注册 - 智障AI</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="description" content="智障AI - 注册页面"/>
    <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🤪</text></svg>">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        .container {
            background-color: white;
            padding: 2rem;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            width: 100%;
            max-width: 400px;
        }
        .header {
            text-align: center;
            margin-bottom: 2rem;
        }
        .header h1 {
            color: #2196f3;
            font-size: 28px;
            margin: 0;
            padding: 10px 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        .form-group {
            margin-bottom: 1rem;
        }
        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: #333;
        }
        .form-group input {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
            font-size: 16px;
        }
        .form-group input:focus {
            outline: none;
            border-color: #2196f3;
        }
        .error-message {
            color: #f44336;
            font-size: 14px;
            margin-top: 0.5rem;
        }
        .btn {
            width: 100%;
            padding: 0.75rem;
            background-color: #2196f3;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .btn:hover {
            background-color: #1976d2;
        }
        .links {
            text-align: center;
            margin-top: 1rem;
        }
        .links a {
            color: #2196f3;
            text-decoration: none;
            font-size: 14px;
        }
        .links a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>
                <span style="font-size: 24px;">🤪</span>
                智障AI
            </h1>
        </div>
        
        <form th:action="@{/register}" method="post" th:object="${user}">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" name="username" required 
                       th:field="*{username}" autocomplete="username"/>
                <div th:if="${#fields.hasErrors('username')}" class="error-message" 
                     th:errors="*{username}">用户名错误</div>
            </div>
            
            <div class="form-group">
                <label for="nickname">昵称</label>
                <input type="text" id="nickname" name="nickname" required 
                       th:field="*{nickname}"/>
                <div th:if="${#fields.hasErrors('nickname')}" class="error-message" 
                     th:errors="*{nickname}">昵称错误</div>
            </div>
            
            <div class="form-group">
                <label for="email">邮箱</label>
                <input type="email" id="email" name="email" 
                       th:field="*{email}" autocomplete="email"/>
                <div th:if="${#fields.hasErrors('email')}" class="error-message" 
                     th:errors="*{email}">邮箱错误</div>
            </div>
            
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" name="password" required 
                       th:field="*{password}" autocomplete="new-password"/>
                <div th:if="${#fields.hasErrors('password')}" class="error-message" 
                     th:errors="*{password}">密码错误</div>
            </div>
            
            <div th:if="${error}" class="error-message" th:text="${error}">
                注册失败
            </div>
            
            <button type="submit" class="btn">注册</button>
        </form>
        
        <div class="links">
            <a th:href="@{/login}">已有账号？立即登录</a>
        </div>
    </div>
</body>
</html> 